﻿-- ============================================================
-- NotifyReceiver Test Data Synchronization Script
-- ============================================================

CREATE TABLE #NotifyReceiver
(
	[MembershipUserId] [int] NOT NULL,
	[Name] [nchar](50) COLLATE Latin1_General_CI_AS_KS_WS NOT NULL,
	[EmailAddress] [nvarchar](130) COLLATE Latin1_General_CI_AS_KS_WS  NULL
)


SET NOCOUNT ON;

DECLARE	@admin_id int 
SELECT @admin_id = a.[Id] FROM [dbo].[MembershipUser] AS a WHERE a.[Name] = 'admin';

INSERT #NotifyReceiver ([MembershipUserId],[Name],[EmailAddress]) 
	VALUES (@admin_id, N'SOAP', N'Will check "EnsureWeb" method by selected service url and check receive time.')
INSERT #CheckType ([Id],[Name],[Desc]) VALUES (2, N'SOAP with param', N'Will check "EnsureWebParam" method by selected service url and check response param.')
INSERT #CheckType ([Id],[Name],[Desc]) VALUES (3, N'Web Page', N'Will find text EnsureWeb on selected web page.')


MERGE [dbo].[CheckType] AS Target
	USING #CheckType AS Source ON (Target.[Id] = Source.[Id])
		WHEN MATCHED THEN
			UPDATE SET Target.[Name] = Source.[Name], Target.[Desc] = Source.[Desc]
		WHEN NOT MATCHED BY TARGET THEN
			INSERT ([Id], [Name], [Desc])
			VALUES ( Source.[Id], Source.[Name], Source.[Desc])
		WHEN NOT MATCHED BY SOURCE
			THEN DELETE ;

DROP TABLE #CheckType;

GO
